package com.prs.crm.domain.flow;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.prs.crm.domain.BaseEntity;

@Entity
@Table(name="flow_instancenode")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
public class WorkFlowInstanceNode extends BaseEntity implements Comparable{

	private static final long serialVersionUID = -7792955532220667408L;
	
	@Id @GeneratedValue(strategy=GenerationType.IDENTITY)
	private Integer id;
	@ManyToOne
	private WorkFlowInstance instance;
	
	private WorkFlowHandler handler;
	@ManyToOne
	private WorkFlowNode flownode;
	
	private Integer sequence;
	
	//责任人类型
	//private Integer responsibleType;
	
	private Integer processMode;//通过类型
	public void setId(Integer id) {
		this.id = id;
	}
	public Integer getId() {
		return id;
	}
	public void setInstance(WorkFlowInstance instance) {
		this.instance = instance;
	}
	public WorkFlowInstance getInstance() {
		return instance;
	}
	public void setFlownode(WorkFlowNode flownode) {
		this.flownode = flownode;
		this.sequence = flownode.getSequence();
	}
	public WorkFlowNode getFlownode() {
		return flownode;
	}
	public void setProcessMode(Integer processMode) {
		this.processMode = processMode;
	}
	public Integer getProcessMode() {
		return processMode;
	}

	public void setHandler(WorkFlowHandler handler) {
		this.handler = handler;
	}
	public WorkFlowHandler getHandler() {
		return handler;
	}
	public void setSequence(Integer sequence) {
		this.sequence = sequence;
	}
	public Integer getSequence() {
		return sequence;
	}
	
	public int compareTo( Object o)
	{
		return this.getSequence()-((WorkFlowInstanceNode)o).getSequence();
	}

}
